package com.stx.day1011;

import java.io.FileInputStream;
import java.io.ObjectInputStream;

/**
 * packageName com.stx.day1011
 *
 * @author YangYi
 * @className DeserializeDemo
 * @date 2025/10/11
 * @description TODO
 */
public class DeserializeDemo {
    public static void main(String[] args) {
        // 反序列化-user
        try {
            // 打开序列化文件
            FileInputStream fis = new FileInputStream("D:/shuangti/user");
            // 反序列化
            ObjectInputStream ois = new ObjectInputStream(fis);
            // 读取文件
            User user = (User)ois.readObject();
            System.out.println(user);
            fis.close();
            ois.close();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
